package com.shangxian.giveithome.code;

import lombok.Getter;

@Getter
public enum CommonCode implements Code {

    SUCCESS(true, 200, "操作成功"),
    UPDATE_SUCCESS(true, 200, "修改成功"),
    DELETE_SUCCESS(true, 200, "删除成功"),
    PARAMETER_ERROR(false, 400, "参数非法"),
    AUTH_NOT_SUCCESS(false, 204, "请登录"),
    TOKEN_ERROR(false, 404, "无效授权"),
    DATA_ERROR(false, 200, "暂无数据"),
    DATA_ERRORS(false, 500, "数据异常"),
    PET_CARD_IS_BANDING(false, 420, "宠牌已经被绑定");

    private boolean success;

    private Integer code;

    private String message;

    CommonCode(boolean success, Integer code, String message) {
        this.success = success;
        this.code = code;
        this.message = message;
    }

    @Override
    public boolean success() {
        return this.success;
    }

    @Override
    public int code() {
        return this.code;
    }

    @Override
    public String message() {
        return this.message;
    }
}
